package edu.hzit.data.controller;

import edu.hzit.data.entity.Income;
import edu.hzit.data.service.IncomeService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("income")
public class IncomeController{
    @Resource
    private IncomeService incomeService;
    @RequestMapping("insert")
    private int insert(Income income) {
        return incomeService.insert(income);
    }

    @RequestMapping("loadList")
    private List<Income> loadList() {
        return incomeService.loadList();
    }

    @RequestMapping("selectById")
    private Income selectById(int incomeId) {
        return incomeService.selectById(incomeId);
    }

    @RequestMapping("delete")
    private int delete(int incomeId) {
        return incomeService.delete(incomeId);
    }

    @RequestMapping("update")
    private int update(Income income) {
        return incomeService.update(income);
    }

    @RequestMapping("sum")
    private int sum(Income income) {
        return incomeService.sum(income);
    }

//    @RequestMapping("sumByMonth")
//    private int sumByMonth(@Param("userId")int userId,@Param("month") int month){
//        return incomeService.sumByMonth(userId,month);
//    }
}
